package com.funtonow.jqdk.adapter;

import android.graphics.Paint;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.funtonow.jqdk.R;
import com.funtonow.jqdk.bean.VipBean;

/**
 * @author Jiajien
 * @date 2019/7/22
 */
public class VipAdapter extends BaseQuickAdapter<VipBean.DataBean, BaseViewHolder> {


    public VipAdapter() {
        super(R.layout.item_vip);
    }

    @Override
    protected void convert(BaseViewHolder helper, VipBean.DataBean item) {

        helper.setText(R.id.tv_vip_name, "会员 - " + item.getCommont())
                .setText(R.id.tv_rel_price, "￥" + item.getPrice())
                .setText(R.id.tv_price,"原价￥"+item.getRelprice());
        TextView textView = helper.getView(R.id.tv_price);
        textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        if (((helper.getAdapterPosition()+1) & 1) != 0){
            helper.setBackgroundRes(R.id.ll_vip, R.mipmap.ic_vip1);
            helper.setTextColor(R.id.pay_vip, mContext.getResources().getColor(R.color.color_F59223));
        }else {
            helper.setBackgroundRes(R.id.ll_vip, R.mipmap.ic_vip2);
            helper.setTextColor(R.id.pay_vip, mContext.getResources().getColor(R.color.color_E2282D));
        }

    }

}
